< previous page page_80 next page >

Page 80
We quickly wrote up the following module to hold the public constants and declarations:
' RasTest #1
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Option Explicit

Public Const RAS_MaxEntryName = 256
Public Const RAS_MaxEntryNameBuffer = 257

Public Type RASENTRYNAME
    dwSize As Long
    szEntryName As String * RAS_MaxEntryNameBuffer
End Type

Public Declare Function RasEnumEntries Lib "rasapi32.dll" _
Alias "RasEnumEntriesA" (ByVal reserved As Long, ByVal _
lpszPhonebook As String, lprasentryname As RASENTRYNAME, _
lpcb As Long, lpcEntries As Long) As Long
The RASENTRYNAME structure string is 257 bytes. The lpcb and lpcEntries parameters are both declared by reference because the function has them defined as LPDWORDa pointer to a Long. We added a form with a list box and the following code:
' RasTest #1
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Option Explicit

Private Sub Form_Load()
   Dim BufferSize As Long
   Dim RasEntries As Long
   Dim RasEntryBuffer() As RASENTRYNAME
   Dim RasEntrySize As Long
   Dim Res As Long
   Dim CurrentEntry As Integer
   Dim RasEntryCount As Long

   ReDim RasEntryBuffer(0)
   RasEntrySize = Len(RasEntryBuffer(0))
   RasEntryBuffer(0).dwSize = RasEntrySize

 
< previous page page_80 next page >